package models;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import play.db.jpa.Model;

@Entity
@Table(name = "member")
public class Member extends Model {

	@Column(name = "address")
	public String address;
	@Column(name = "company")
	public String company;
	@Column(name = "dateTime", length = 19)
	public Timestamp dateTime;
	@Column(name = "fax")
	public String fax;
	@Column(name = "loginemail")
	public String loginemail;
	@Column(name = "name")
	public String name;
	@Column(name = "password")
	public String password;
	@Column(name = "tel")
	public String tel;
	@Column(name = "url")
	public String url;
	@Column(name = "zip")
	public String zip;
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<Trade> trades = new HashSet<Trade>(0);
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<Sale> sales = new HashSet<Sale>(0);

	public Member() {
	}

	public Member(String address, String company, Timestamp dateTime, String fax, String loginemail, String name,
			String password, String tel, String url, String zip, Set<Trade> trades, Set<Sale> sales) {
		this.address = address;
		this.company = company;
		this.dateTime = dateTime;
		this.fax = fax;
		this.loginemail = loginemail;
		this.name = name;
		this.password = password;
		this.tel = tel;
		this.url = url;
		this.zip = zip;
		this.trades = trades;
		this.sales = sales;
	}

}